package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.mapper.FacilityVersionMapper;
import com.kaili.basic.pojo.dto.MdmFacilityVersionDto;
import com.kaili.basic.pojo.entity.MdmFacilityVersion;
import com.kaili.basic.pojo.vo.MdmFacilityVersionVO;
import com.kaili.basic.service.IFacilityVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Desc: 版本设置服务类实现
 * @author: PF12Z08Z
 * @Time: 2019/7/25 18:55
 * @Copyright: © 2018 杭州凯立通信有限公司 版权所有
 * @Warning: 本内容仅限于公司内部传阅, 禁止外泄或用于其它商业目的
 */
@Service
public class FacilityVersionServiceImpl implements IFacilityVersionService {

    @Autowired
    private FacilityVersionMapper facilityVersionMapper;

    @Override
    public String getUsableCode() {
        return facilityVersionMapper.getUsableCode();
    }

    @Override
    public void updateVersionCodeStatusUsing(String code) {
        facilityVersionMapper.updateVersionCodeStatusUsing(code);
    }

    @Override
    public void createdVersionCode(Map<String, Object> map) {
        facilityVersionMapper.createdVersionCode(map);
    }

    @Override
    public void updateVersionCodeStatusUsed(String code) {
        facilityVersionMapper.updateVersionCodeStatusUsed(code);
    }

    @Override
    public void updateVersionCodeStatusUnuse(String code) {
        facilityVersionMapper.updateVersionCodeStatusUnuse(code);
    }

    @Override
    public Page<MdmFacilityVersionVO> queryFacilityVersionByConditions(Page<MdmFacilityVersionVO> facilityVersionPage, MdmFacilityVersionDto dto) {
        List<MdmFacilityVersionVO> FacilityVersionVOs = facilityVersionMapper.queryFacilityVersionByConditions(facilityVersionPage,dto);
        return facilityVersionPage.setRecords(FacilityVersionVOs);
    }

    @Override
    public MdmFacilityVersion queryVersionByCode(String versionCode) {
        return facilityVersionMapper.queryVersionByCode(versionCode);
    }

    @Override
    public int addDocument(MdmFacilityVersion entity) {
        int result = 1;
        facilityVersionMapper.insert(entity);
        return result;
    }

    @Override
    public List<MdmFacilityVersionVO> queryAllFacilityVersion() {
        return facilityVersionMapper.queryAllFacilityVersion();
    }
}
